/**
 * Created by Lee on 2018/12/29.
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

import Login from './pages/Login.vue'
import Layout from './pages/Layout.vue'
import Article from './pages/Article.vue'
import ArticleList from  './pages/article/List.vue'
import NewArticle from  './pages/article/New.vue'
import ArticleDetail from './pages/article/Detail.vue'
import Test1 from './pages/Test1.vue'
import Test2 from './pages/Test2.vue'


const routes = [
    {
        path:'/login',
        component:Login
    },
    {
        path:'/layout',
        component:Layout,
        redirect:'/article',
        children:[
            {
                path:'/article',
                component:Article,
                children:[
                    {
                        path:'/article/list',
                        component:ArticleList
                    },
                    {
                        path:'/article/new',
                        component:NewArticle
                    },
                    {
                        path:'/article/:articleId',
                        component:ArticleDetail,
                        props:true
                    }
                ],
                redirect:'/article/list'
            },
            {
                path:'/test1',
                component:Test1
            },
            {
                path:'/test2',
                component:Test2
            }
        ]
    },
    {
        path:'/',
        redirect:'/login'
    }
];

let router = new VueRouter({
    routes
})

export default router;

